<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<!--[if IE 8]>
<html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en"> <!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>电商运营管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta name="author" content="pigv5"/>
    <link rel="shortcut icon" href="__TMPL__Public/img/favicon_dj.ico"/>
    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="__TMPL__Public/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/plugins/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/css/style-metro.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/css/style-responsive.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/plugins/uniform/css/uniform.default.css" rel="stylesheet" type="text/css"/>


    <!-- END GLOBAL MANDATORY STYLES -->
    <link href="__TMPL__Public/css/global.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/css/pages/login-soft.css" rel="stylesheet" type="text/css"/>
    <link href="__TMPL__Public/css/code.css" rel="stylesheet" type="text/css"/>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body class="login">
<!-- BEGIN LOGO -->
<div class="logo">{$Config['sitename']}</div>
<!-- END LOGO -->
<!-- BEGIN LOGIN -->
<div class="content">
    <!-- BEGIN LOGIN FORM -->
    <form class="form-vertical login-form" action="__SELF__" method="post">
        <h3 class="form-title">后台登录</h3>

        <div class="alert alert-error hide">
            <button class="close" data-dismiss="alert"></button>
            <span>请输入用户名和密码！</span>
        </div>
        <div class="control-group">
            <!--ie8, ie9 does not support html5 placeholder, so we just show field title for that-->
            <label class="control-label visible-ie8 visible-ie9">用户名</label>

            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-user"></i>
                    <input class="m-wrap placeholder-no-fix" type="text" placeholder="用户名" name="username" value="{$Think.cookie.username}"/>
                </div>
            </div>
        </div>
        <div class="control-group">
            <label class="control-label visible-ie8 visible-ie9">密码</label>

            <div class="controls">
                <div class="input-icon left">
                    <i class="icon-lock"></i>
                    <input class="m-wrap placeholder-no-fix" type="password" placeholder="密码" name="password" value="{$Think.cookie.password}"/>
                </div>
            </div>
        </div>
        <div class="control-group">
            <div class="code-box">
                <span class="code-update" id="changeCode"></span>
                <span class="code-pic"><img src="{:U('Login/code')}" id="verifyImg"/></span>
                <div class="input-icon left">
                    <i class="icon-barcode"></i>
                    <input class="form-control" type="text" name="code" autocomplete="off" placeholder="验证码"/>
                </div>
            </div>
        </div>
        <div class="form-actions">
            <label class="checkbox">
				<input type="checkbox" name="remember" value="1" <eq name="Think.cookie.remember" value="1">checked</eq> /> 记住我
            </label>
            <button type="submit" class="btn green pull-right">
                登录 <i class="m-icon-swapright m-icon-white"></i>
            </button>
            <input type="hidden" name="logintype" value="login"/>
        </div>
    </form>
    <!-- END LOGIN FORM -->
</div>
<!-- END LOGIN -->
<!-- BEGIN COPYRIGHT -->
<div class="copyright">
    Powered by {$Config['copyright']} &copy; <?php echo date('Y');?>.
    <a href="http://www.miitbeian.gov.cn" target="_blank" class="blue">沪ICP备19000513号-1</a>
</div>
<!-- END COPYRIGHT -->

<!-- BEGIN JAVASCRIPTS(Load javascripts at bottom, this will reduce page load time) -->
<!-- BEGIN CORE PLUGINS -->
<script src="__TMPL__Public/plugins/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/jquery-migrate-1.2.1.min.js" type="text/javascript"></script>
<!-- IMPORTANT! Load jquery-ui-1.10.1.custom.min.js before bootstrap.min.js to fix bootstrap tooltip conflict with jquery ui tooltip -->
<script src="__TMPL__Public/plugins/jquery-ui/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
<!--[if lt IE 9]>
<script src="__TMPL__Public/plugins/excanvas.min.js"></script>
<script src="__TMPL__Public/plugins/respond.min.js"></script>
<![endif]-->
<script src="__TMPL__Public/plugins/jquery-slimscroll/jquery.slimscroll.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/jquery.blockui.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/jquery.cookie.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/uniform/jquery.uniform.min.js" type="text/javascript"></script>
<!-- END CORE PLUGINS -->
<!-- BEGIN PAGE LEVEL PLUGINS -->
<script src="__TMPL__Public/plugins/jquery-validation/dist/jquery.validate.min.js" type="text/javascript"></script>
<script src="__TMPL__Public/plugins/backstretch/jquery.backstretch.min.js" type="text/javascript"></script>
<!-- END PAGE LEVEL PLUGINS -->
<!-- BEGIN PAGE LEVEL SCRIPTS -->
<script src="__TMPL__Public/scripts/app.js" type="text/javascript"></script>
<script src="__TMPL__Public/scripts/login-soft.js" type="text/javascript"></script>
<!-- END PAGE LEVEL SCRIPTS -->
<script>
	//后台找密
	$('.forget-form .subBtn').on('click',function(){
		var _form = $('.forget-form');
		var url = _form.attr('action');
		var type= _form.attr('method');
		var data = _form.serialize();
		var btn = $(this);
		var msg = _form.find('.alert');
		var reg = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
		
		if(!$('.email').val()){
			msg.removeClass('alert-success').addClass('alert-error').show();
			msg.show().find('span').text('邮箱为必填！');
			return false;
		}else if(!reg.test($('.email').val())){
			//msg.removeClass('alert-success').addClass('alert-error').show();
			msg.show().find('span').text('邮箱地址有误！');
			return false;
		}
		
		$.ajax({
			type:type,
			url:url,
			data:data,
			dataType:'json',
			success:function(json){
				btn.removeAttr('disabled').removeClass('disabled');
				if(json.status==0){
					msg.removeClass('alert-success').addClass('alert-error');
				}else{
					msg.removeClass('alert-error').addClass('alert-success');
				}
				msg.show().find('span').text(json.info);
			},
			beforeSend:function(){
				btn.attr('disabled','disabled').addClass('disabled');
			},
		});
		
		return false;
	})
    jQuery(document).ready(function () {
        App.init();
        Login.init();
        $.backstretch([
            "__TMPL__Public/img/bg/1.jpg",
            "__TMPL__Public/img/bg/2.jpg",
            "__TMPL__Public/img/bg/3.jpg",
            "__TMPL__Public/img/bg/4.jpg"
        ], {
            fade: 1000,
            duration: 8000
        });
    });
	
	//更换验证码
	$('body').on('click','#changeCode',function(){
	    var num=Math.random(0,100000);
        var url = "{:U('Login/code')}"; 
	    var verifyImgUrl = url + "&nm=" + num;
	    $.ajax({
			type:"get",
			url:"{:U('Login/code')}",
			success:function(){
			    $('#verifyImg').attr('src',verifyImgUrl);
			},
			beforeSend:function(){
			    $("#changeCode").addClass('code-rotate');	
			},
			complete:function(){
				$("#changeCode").removeClass('code-rotate');
			}
	    });
	})
	$('body').on('focus','.error .code-box input',function(){
		$(this).parents('.code-box').css('border-color','#ddd');
	});
	$('body').on('blur','.error .code-box input',function(){
		$(this).parents('.code-box').css('border-color','#b94a48');
	});
	//每次刷新都更新验证码
    $("#changeCode").trigger("click");
	
</script>
<!-- END JAVASCRIPTS -->

</body>
<!-- END BODY -->
</html>